grib2ctl in Perl

Grib2ctl has been rewritten in Perl and
all the future enhancements will be in Perl ONLY.
Reasons for changing to Perl are:
- Perl version is 1.5x-10x faster
- Perl supports structured code which is important as code size increases
- Perl is universal and free
Writing grib2ctl as a shell script was fine when it was
89 lines long and only supported Reanalysis files.
As the grib2ctl grew, it became more and more difficult
to maintain. Going to Perl will allow the program to support
more files. The Perl version is now in
Alpha-testing.
Going to the Perl version ranges from transparent to painful.
Assuming you have a version of Perl5, you only need
to change the first line of the script. If you don't
have Perl5 installed, you are going to have to obtain it.
If Perl isn't on your machine, ask your sys-admin to install it.
Perl is free so they can't use money as an excuse.
The perl version works in Windows95 and will be
tested using the DOS version of Perl. Any
volunteers for a Mac port?
Requirements:
- needs perl version 5, to find the version: $ perl -v
- need to change the first line to #!(location of perl)
Grib2ctl is a bourne/korn/bash shell script that tries to make a
GrADS .ctl file from a GRIB file. The script is some what restrictive in the
form/content of the GRIB file. Nevertheless this script and earlier
versions have made .ctl files for gigabytes of files. See the
documentation for more details.
The current version is 0.9.12.?, and requires
wgrib v1.6.0. This version adds,
- handling of forecast time series
- 4 year date code
- simpler names (optional and can cause problems)
- new options
- support for Windows 95/NT
Requirements:
- wgrib v1.6.0+ must be on your path
- wgrib v1.6.0+ must be on your path
- UNIX: bourne/bash/korn shell
- Linux: bash shell
- Windows 95/NT: bash
shell and misc. GNU utilities
- MS-DOS: Linux
Problems:
- will get confused by non-NCEP grid definitions
- doesn't handle mixed analysis and variance files
- missing times not handled well
- doesn't handle multiple vertical coordinates well
Files:
Questions:
- Why doesn't grib2ctl work?
- Why is the xdef and ydef missing from the .ctl file?
- Many grids were not included in the script. Send me the
grid number, "xdef", "ydef" and "pdef" if applicable and the new
grid can be added to the script.
- I made a .ctl and .idx file with no problem. Why can't I display
anything?
- One common problem is that grib2ctl uses the initial time
rather than the verification time by default. On the other hand,
gribmap uses the verification time by default. To use initial
time, use the "-0" (zero) option on gribmap. To use the verification
time, use "-verf" option on grib2ctl.
- Why is grib2ctl so slow?
- It is written as a shell script which is much slower than a
compiled program.
- Why did you write it in shell script?
- Grib2ctl was originally a quick and dirty program weighing in
at 89 lines without comments. The size has more than quadrupled.
- I get "user defined grid .. only partially decoded .. pot. problems"
- grib2ctl is very stupid about user-defined grids. For example, if a
user-defined grid has a dimension of 144x73, the grib2ctl generates
a ctl file for a NP-SP, 2.5 x 2.5 degree grid. Since the guess
could be wrong, grib2ctl generates a warning (see above). When you
get this warning, you should check that ctl file has the correct
grid information.
- How do I get grib2ctl to use the template option?
- Grib2ctl doesn't generate control files with the template
option. It is not difficult to add the template option to
a regular control file. (Change the dset, tdef
and options lines.)
Links
- Perl home page
source code, win exe, documentation, news, book reviews
- HP and Perl:
info,
compiling
home
Comments: ebis@wesley.wwb.noaa.gov